# /usr/bin/python3
# -*- coding: utf-8 -*-
# @Time    : 2022/1/11 9:09
# @Author  : lt
# @Email   : lt@163.com
# @File    : login_page.py
# @Software: PyCharm
from selenium.webdriver.common.by import By
from page.KHGL_page.Base_Page import BasePage


class LoginPage(BasePage):

    username_locator = (By.NAME,'name')
    password_locator = (By.NAME, 'password')
    submit_locator = (By.NAME, 'submit')

    # def __init__(self,driver):
    #     '''要求实例化的时候传递driver'''
    #     self.driver = driver
    def __init__(self,driver):
        super().__init__(driver)
        self.url = self.url + '/crm'

    def username_input(self,username):
        self.driver.find_element(*self.username_locator).send_keys(username)

    def password_input(self,password):
        self.driver.find_element(*self.password_locator).send_keys(password)

    def sumbit_click(self):
        self.driver.find_element(*self.submit_locator).click()

    def open(self):
        self.driver.get(self.url)